package priv.yiyuan.example.composite;

/**
 * 标题类
 * <p>
 * 组合模式-叶子节点
 *
 * @author YiYuan
 * @data 2025/8/28
 * @apoNote
 */
public class Heading implements DocumentComponent {

    private String text;

    private int level;

    public Heading(String text, int level) {
        this.text = text;
        this.level = level;
    }

    @Override
    public void render() {
        System.out.println(String.format("<%s>%s</%s>", "h" + level, text, "h" + level));
    }
}
